<!DOCTYPE html>
<html lang="en">
	<head>
		<title> New Document </title>
		<meta charset="utf-8">
		<meta name="Author" content="">
		<meta name="Keywords" content="">
		<meta name="Description" content="">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<!-- Bootstrap -->
		<link href="${webRoot}resources/css/bootstrap.min.css" rel="stylesheet" media="screen">
		<link href="${webRoot}resources/css/style.css" rel="stylesheet">
		<script src="http://code.jquery.com/jquery-1.10.0.min.js"></script>
	</head>
<body class="main">
	<div class="wrap add-shop">
	<ul class="breadcrumb">
		    <li><span id="test">您当前的位置：</li>
		    <li class="active">${addContext}</li>
	    </ul>
		<form class="form-horizontal" method="post"
			enctype="multipart/form-data"
			action="${webRoot}context/addContextInfo.do" id="goodsInfo">
		  <div class="control-group">
		    <label class="control-label" for="title">板块标题</label>
		    <div class="controls">
		      <input type="text" id="title" name="title">
		    </div>
		  </div>
		  <div class="control-group">
		    <label class="control-label" for="content">板块简介</label>
		    <div class="controls">
		      <textarea rows="2" id="content" name="content"></textarea>
		    </div>
		  </div>
		   <div class="control-group">
				<label class="control-label" for="file">板块图标</label>
				<div class="controls">
					<input type="file" id="file1" name="file">
					<div class="preview1">
						<img src="" id="image1">
					</div>
				</div>
			</div>
		 <div class="control-group">
		    <label class="control-label" for="textset">文字限制</label>
		    <div class="controls">
		      <select id="textset" name="textset" onchange="changtext()">
				<option value="">请选择</option>
				<option value="Y">是</option>
				<option value="N">否</option>
			</select>
		    </div>
		  </div>
		   <div class="control-group" style="display:none;" id="textn">
		    <label class="control-label" for="textnum">字数限制</label>
		    <div class="controls">
		      <input type="number" id="textnum" name="textnum">
		    </div>
		  </div>
		 <div class="control-group">
		    <label class="control-label" for="imgset">图片限制</label>
		    <div class="controls">
		      <select id="imgset" name="imgset" onchange="changimg()">
				<option value="">请选择</option>
				<option value="Y">是</option>
				<option value="N">否</option>
			</select>
		    </div>
		  </div>
		  <div class="control-group" style="display:none;" id="imgnu">
		    <label class="control-label" for="imgnum">图片大小限制</label>
		    <div class="controls">
		      <input type="number" id="imgnum" name="imgnum">
		    </div>
		  </div>
		  <div class="control-group" style="display:none;" id="img">
		    <label class="control-label" for="imgno">图片数量限制</label>
		    <div class="controls">
		      <input type="number" id="imgno" name="imgno">
		    </div>
		  </div>
		 <div class="control-group">
		    <label class="control-label" for="voiceset">语音限制</label>
		    <div class="controls">
		      <select id="voiceset" name="voiceset" onchange="changvoice()">
				<option value="">请选择</option>
				<option value="Y">是</option>
				<option value="N">否</option>
			</select>
		    </div>
		  </div>
		  <div class="control-group" style="display:none;" id="voicen">
		    <label class="control-label" for="voicenum">语音时长限制</label>
		    <div class="controls">
		      <input type="number" id="voicenum" name="voicenum">
		    </div>
		  </div>
		 <div class="control-group">
		    <label class="control-label" for="videoset">视频限制</label>
		    <div class="controls">
		      <select id="videoset" name="videoset">
				<option value="">请选择</option>
				<option value="Y">是</option>
				<option value="N">否</option>
			</select>
		    </div>
		  </div>
		   <div class="control-group">
		    <label class="control-label" for="score">板块分数</label>
		    <div class="controls">
		      <input type="number" id="score" name="score">
		    </div>
		  </div>
		  <div class="control-group">
				<label class="control-label" for="file">板块背景图</label>
				<div class="controls">
					<input type="file" id="file2" name="file">
					<div class="preview2" >
						<img src="" id="image2">
					</div>
				</div>
			</div>  		    
		  <div class="control-group">
		    <div class="controls">
		      <button type="button" class="btn" onclick="checkContext()">确认添加</button>
		    </div>
		  </div>
		</form>			 	
	</div>			
	<script src="${webRoot}resources/js/jquery-1.9.1.min.js"></script>
	<script src="${webRoot}resources/js/bootstrap.min.js"></script>
	<script src="${webRoot}resources/js/js.js"></script>
    <script type="text/javascript">
        function checkContext(){
        	var goodsName = $("#title").val();
        	if($.trim(goodsName) == null ||$.trim(goodsName) =="" ){
        		alert("板块标题不能为空！");
        		return;
        	}
        	var goodsJingdu= $("#content").val();
        	if($.trim(goodsJingdu) == null ||$.trim(goodsJingdu) =="" ){
        		alert("板块简介不能为空！");
        		return;
        	}
        	var goodsWeiDu= $("#file1").val();
        	if($.trim(goodsWeiDu) == null ||$.trim(goodsWeiDu) =="" ){
        		alert("板块图标不能为空！");
        		return;
        	}
        	var goodstelephone= $("#textset").val();
        	if($.trim(goodstelephone) == null ||$.trim(goodstelephone) =="" ){
        		alert("文字限制不能为空！");
        		return;
        	}
        	var uplabelId= $("#imgset").val();
        	if($.trim(uplabelId) == null ||$.trim(uplabelId) =="" ){
        		alert("图片限制不能为空！");
        		return;
        	}
        	var labelId= $("#voiceset").val();
        	if($.trim(labelId) == null ||$.trim(labelId) =="" ){
        		alert("语音限制不能为空！");
        		return;
        	}
        	var goodsAddress= $("#videoset").val();
        	if($.trim(goodsAddress) == null ||$.trim(goodsAddress) =="" ){
        		alert("视频限制不能为空！");
        		return;
        	}
        	var goods_Desc= $("#score").val();
        	if($.trim(goods_Desc) == null ||$.trim(goods_Desc) =="" ){
        		alert("板块分数不能为空！");
        		return;
        	}
        	var file= $("#file2").val();
        	if($.trim(file) == null ||$.trim(file) =="" ){
        		alert("板块背景图片不能为空！");
        		return;
        	}
        	document.getElementById("goodsInfo").submit();
        }
        
        function changtext(){
        	var text= $("#textset").val();
        	if(text == "Y"){
        		$("#textn").show();
        	}else{
        		$("#textn").hide();
        		$("#textnum").val("");
        	}
        }
         function changimg(){
        	var text= $("#imgset").val();
        	if(text == "Y"){
        		$("#imgn").show();
        		$("#imgnu").show();
        	}else{
        		$("#imgn").hide();
        		$("#imgnu").hide();
        		$("#imgnum").val("");
        		$("#imgno").val("");
        	}
        }
         function changvoice(){
        	var text= $("#voiceset").val();
        	if(text == "Y"){
        		$("#voicen").show();
        	}else{
        		$("#voicen").hide();
        		$("#voicenum").val("");
        	}
        }
        
    </script>

</body>
</html>
